﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Presentation.Pages
{
    public partial class AlbumFotoCadastrar : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            DEFoto album;
            using (ministerioprosperid1Entities banco = new ministerioprosperid1Entities())
            {
                album = new DEFoto()
                {
                    Data = DateTime.Today,
                    Titulo = txtTitulo.Text,
                    Diretorio = txtDiretorio.Text
                };

                banco.AddToDEFotoes(album);
                banco.SaveChanges();
            }

            this.txtTitulo.Text = String.Empty;
            this.txtDiretorio.Text = String.Empty;

            Util.showMessage(this, "Album cadastrado com sucesso", "../Pages/fotos.aspx?id=" + album.Codigo);
        }
    }
}